<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use DB;

class ApiRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        $config = DB::table('configs')->first();   
        
        if($config->token == $this->token) {            
            return true;
        }        
        return false;
       
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'token'      => 'required',           
           
        ];
    }

    /**
     * 错误信息
     * @return array
     */
    public function messages()
    {
        return [
            'token.required'         => 'token错误',     
            
                 
        ];
    }

    
}
